﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using contactusform.common;

namespace contactusform.web
{
    public class UtilitiesHelper
    {
        /// <summary>
        /// Checks if the passed DateTime is within the allowed calling hours.
        /// </summary>
        /// <param name="date">DateTime to be validated</param>
        /// <returns>True or false based on the validation result</returns>
        public static bool IsValidDateTimeToCall(DateTime date)
        {

            return (date >= DateTime.Now && date.TimeOfDay >= Utils.OpeningTime
                                                              && date.TimeOfDay <= Utils.ClosingTime && date.Minute % 15 == 0);

        }

    }
}